#include<stdio.h>
#include<arpa/inet.h>
//将字符串信息转化为网络字节序的整数型
int main(int argc,char *argv[])
{
	char *addr1="1.2.3.4";
	char *addr2="1.2.3.256";
	//转化网络字节序
	unsigned long conv_addr=inet_addr(addr1);
	if(conv_addr==INADDR_NONE)
		printf("Error occured! \n");
	else
		printf("Network ordered integer addr:%#lx \n",conv_addr);
	conv_addr=inet_addr(addr2);
	if(conv_addr==INADDR_NONE)
		printf("Error occureded \n");
	else
		printf("Network ordered integer addr:%#lx \n\n",conv_addr);
	return 0;
}
